<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html" 
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <f:view>
        <h:head>
            <title>File Upload</title>
        </h:head>
        <h:body>
            <h1> File Upload(Ajax)</h1>
            <h:messages globalOnly="true" showDetail="false" showSummary="true"/>
            <h:form enctype="multipart/form-data">
                 <h:inputFile id="file" value="#{fileUploadBean.file}" >
                    <f:validator validatorId="fileValidator"/>
                    <f:ajax execute="@this" render="@form"/>
                </h:inputFile>
                <h:message for="file"/>
                <h:commandButton value="Upload" action="#{fileUploadBean.upload()}"/>
            </h:form>
        </h:body>
    </f:view>
</html>
